package tutorial.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import tutorial.mapper.HelloWorldMapper;
import tutorial.service.IHelloWorldService;

import com.hyd.common.constant.DatePattern;
import com.hyd.common.util.DateUtil;

/**
 * @Service the default bean name of HelloWorldServiceImpl in Spring is
 * helloWorldServiceImpl 
 * @author Administrator
 *
 */
@Service
public class HelloWorldServiceImpl implements IHelloWorldService{

	@Autowired
	private HelloWorldMapper helloWorldMapper;
	
	@Override
	@Transactional(readOnly = true)
	public String getSysdate() {
		Date d = helloWorldMapper.getSysdate();
		return DateUtil.format(d, DatePattern.D8_H6);
	}
	
	@Override
	@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
	public int deleteSth() {
		return 0;
	}
}
